package com.ficus.road.maintain.core.model.zh;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.ficus.road.maintain.core.model.Hit;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.List;

/**
 * @author xiawen yang
 * @date 2022/7/15 下午4:45
 */
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class DiseaseLocationRequest {

    @JsonProperty("coordList")
    private List<DiseaseLocation> coordList;
    @JsonProperty("coordType")
    private String coordType;

    @Data
    @Builder
    @AllArgsConstructor
    @NoArgsConstructor
    public static class DiseaseLocation {
        private String lat;

        private String lng;

        private String diseaseID;

        public static DiseaseLocation convert2DiseaseLocation(Hit hit) {
            return DiseaseLocation.builder()
                    .lat(hit.getAttrs().getLocation().get(1) + "")
                    .lng(hit.getAttrs().getLocation().get(0) + "")
                    .diseaseID(hit.getId())
                    .build();
        }
    }
}
